package com.kongyz;

import com.kongyz.flowable.AbstractFlowChain;
import com.kongyz.flowable.FlowChainEnum;
import com.kongyz.logger.AbstractLogger;
import com.kongyz.logger.DebugLogger;
import com.kongyz.logger.ErrorLogger;
import com.kongyz.logger.InfoLogger;

/**
 * @author kongyz
 * @date 2018/6/30 13:54
 * @Description:
 */
public class Demo {

    /**
     * 确定责任链上下层级关系
     * @return
     */
    private static AbstractLogger getChainOfLoggers(){
        AbstractLogger infoLogger=new InfoLogger(AbstractLogger.INFO);
        AbstractLogger debugLogger=new DebugLogger(AbstractLogger.DEBUG);
        AbstractLogger errorLogger=new ErrorLogger(AbstractLogger.ERROR);
        infoLogger.setNextLogger(debugLogger);
        debugLogger.setNextLogger(errorLogger);

        return infoLogger;
    }

    public static void main(String[] args) {
        //AbstractLogger loggerChain=getChainOfLoggers();
        //loggerChain.logMessage(AbstractLogger.ERROR,"Error异常！");
        //loggerChain.logMessage(AbstractLogger.DEBUG,"DEBUG异常！");
        //loggerChain.logMessage(AbstractLogger.INFO,"INFO异常！");

        //每个责任链都会执行，
        AbstractFlowChain flowChain=AbstractFlowChain.getChain();
        flowChain.notifyChanged(FlowChainEnum.project,"aaaa");

    }



}
